AS=/usr/local/mips-cross/bin/mipsel-elf-as
CC=/usr/local/mips-cross/bin/mipsel-elf-gcc
LD=/usr/local/mips-cross/bin/mipsel-elf-ld
OBJCOPY=/usr/local/mips-cross/bin/mipsel-elf-objcopy
OBJDUMP=/usr/local/mips-cross/bin/mipsel-elf-objdump

all:
	$(AS) -mips1 div.S -o div.o -EL 
	$(LD) -mips1 -T ../../lib/default.ld div.o -o div.elf -EL
	$(OBJCOPY) -j .startup.bootvec -j .startup -O binary div.elf div.bin
	hexdump -e "1/4 \"%08x\n\"" div.bin -v > div.hex
	cat ../../lib/nops.hex >> div.hex
	
dump:
	$(OBJDUMP) -j .startup.bootvec -j .startup -D div.elf

symbols:
	$(OBJDUMP) -t div.elf

sections:
	$(OBJDUMP) -h div.elf

clean:
	rm -f div.bin div.elf div.hex div.o
